//-----------------------------------------------------------------------
// <copyright file="MajorMarketService.cs" company="FetCo">
//     Copyright (c) FetCo. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using FetCo.Framework;
using ADESSA.Entities;
using ADESSA.Data;
    
namespace ADESSA.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class MajorMarketService
    {
        #region MajorMarket

        public static void CreateMajorMarket(MajorMarket majorMarket)
        {            
            try
            {
                MajorMarketDAO majorMarketDAO = new MajorMarketDAO();
                majorMarketDAO.CreateMajorMarket(majorMarket);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessCreateMajorMarketException, ex);
            }
        }        

        public static void UpdateMajorMarket(MajorMarket majorMarket)
        {            
            try
            {
                MajorMarketDAO majorMarketDAO = new MajorMarketDAO();
                majorMarketDAO.UpdateMajorMarket(majorMarket);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessUpdateMajorMarketException, ex);
            }
        }        

        public static void DeleteMajorMarket(int majorMarketID)
        {            
            try
            {
                MajorMarketDAO majorMarketDAO = new MajorMarketDAO();
                majorMarketDAO.DeleteMajorMarket(majorMarketID);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessDeleteMajorMarketException, ex);
            }
        }
        
        public static MajorMarket GetMajorMarket(int majorMarketID)
        {            
            try
            {
                MajorMarketDAO majorMarketDAO = new MajorMarketDAO();
                return majorMarketDAO.GetMajorMarket(majorMarketID);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetMajorMarketException, ex);
            }
        }                

        public static MajorMarketCollection GetMajorMarketList(MajorMarketColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                MajorMarketDAO majorMarketDAO = new MajorMarketDAO();
                return majorMarketDAO.GetMajorMarketList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetMajorMarketListException, ex);
            }
        }        

        public static MajorMarketCollection GetMajorMarketList(MajorMarketColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                MajorMarketDAO majorMarketDAO = new MajorMarketDAO();
                return majorMarketDAO.GetMajorMarketList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetMajorMarketListException, ex);
            }
        }        

	    public static MajorMarketCollection GetMajorMarketListByParam(object orderBy, OrderDirection orderDirection,string where)
        {            
            try
            {
                MajorMarketDAO majorMarketDAO = new MajorMarketDAO();
                return majorMarketDAO.GetMajorMarketListByParam(orderBy, orderDirection,where);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetMajorMarketListException, ex);
            }
        }        

        public static MajorMarketCollection GetMajorMarketListByParam(object orderBy, OrderDirection orderDirection, int page, int pageSize,string Criteria, out int totalRecords)
        {            
            try
            {
                MajorMarketDAO majorMarketDAO = new MajorMarketDAO();
                return majorMarketDAO.GetMajorMarketListByParam(orderBy, orderDirection, page, pageSize,Criteria, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetMajorMarketListException, ex);
            }
        }        

        #endregion
    }
}